package top.yuyufeng;

import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;

import java.util.Date;
import java.util.concurrent.TimeUnit;

/**
 * @author yuyufeng
 * @date 2018/11/8.
 */
public class MyTask implements Runnable {
    @Override
    public void run() {
        while (true) {
            try {
                TimeUnit.MILLISECONDS.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            TextWebSocketFrame tws = new TextWebSocketFrame(new Date().toString() + "：" + "群发");
            // 群发
            Global.group.writeAndFlush(tws);
        }
    }
}
